x86/p2m: refactor p2m_reset_altp2m()
authorRazvan Cojocaru <rcojocaru@bitdefender.com>
Sat, 22 Dec 2018 09:43:50 +0000 (09:43 +0000)
committerGeorge Dunlap <george.dunlap@citrix.com>
Sat, 22 Dec 2018 09:43:50 +0000 (09:43 +0000)
commit6e23f46ea9bb7403c9b6d29449a35d1381f1c56e
tree99078275c385eb415014ca4b0e3653e396a49de4
parent95ba8404d45df56b3c8db88ea0bd414ad6638962
x86/p2m: refactor p2m_reset_altp2m()

Refactor p2m_reset_altp2m() so that it can be used to remove
redundant codepaths, fixing the locking while we're at it.

The previous code now replaced by p2m_reset_altp2m(d, i,
ALTP2M_DEACTIVATE) calls did not set p2m->min_remapped_gfn
and p2m->max_remapped_gfn because in those cases the altp2m
idx was disabled; so before getting used again,
p2m_init_altp2m_ept() would get called, which resets them.
Always setting them in p2m_reset_altp2m(), while redundant,
is preferable to an extra conditional.

Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Tested-by: Tamas K Lengyel <tamas@tklengyel.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
xen/arch/x86/mm/p2m.c